#include <cstdlib>
#include <iostream>

#include "IDrawable.h"

void IDrawable::drawShadow(Vec3f pos, Vec3f dif, int index)
{
   
}
int IDrawable::_count = 0;
vector<IDrawable*> IDrawable::_drawables;

IDrawableObject::IDrawableObject() : shininess(64) 
{ 
   color = Vec3f(1, 1, 1);
   specular = Vec3f(.6,.6,.6);
}

void IDrawableObject::draw(bool ortho)
{
    glColor4f(color[0], color[1], color[2], 1.0);
    GLfloat specReflect[] = {specular[0], specular[1], specular[2], 1.0f};
    
    glEnable(GL_COLOR_MATERIAL);
    
    glColorMaterial(GL_FRONT, GL_AMBIENT_AND_DIFFUSE);
    
    glMaterialfv(GL_FRONT, GL_SPECULAR, specReflect);
    glMateriali(GL_FRONT, GL_SHININESS, shininess); 
   
   glEnable(GL_BLEND);
   glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
   glAlphaFunc(GL_GREATER,0.1f);
   glEnable(GL_ALPHA_TEST);
}

void IDrawableObject::drawShadow(Vec3f pos, Vec3f dif, int index)
{
   
}
void IDrawableObject::setShininess(int _shininess)
{
   shininess = _shininess;
}
void IDrawableObject::setSpecular(Vec3f _specular)
{
   specular = _specular;
}
void IDrawableObject::setColor(Vec3f _color)
{
   color = _color;
}


